home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Code Samples / hotspots / rlovrbut.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  1.6 KB  |  52 lines  |  [TEXT/ttxt]

  1. in module DemoModule
  2.  
  3. --*******************************************************************************
  4. --*        Class name:    RolloverButton
  5. --*                                            
  6. --*     Inherits from: TwoDShape, Button and Rollover                                    
  7. --*        Class type: Concrete
  8. --*         Component: User Interface
  9. --*
  10. --*       Description: This class is an example of how to mix in the Button class
  11. --*                    the Rollover class with a TwoDShape to produce a button that
  12. --*                    responds when the mouse enters or leaves its boundary.
  13. --*
  14. --*             Usage: rb := new RolloverButton enterBitmap:<some bitmap> \
  15. --*                                             exitBitmap:<some bitmap> \
  16. --*                                             releasedBitmap:<same bitmap as exitBitmap> \
  17. --*                                             pressedBitmap:<some bitmap> 
  18. --*                    
  19. --*               IVs:        
  20. --*
  21. --*           Methods:    setPressedAppearance
  22. --*                    setReleasedAppearance
  23. --*                    
  24. --*    Required files:    button.sx
  25. --*                    rollover.sx
  26. --*                    
  27. --*             Notes: When using the Rollover class with the Button class, since 
  28. --*                    the exit appearance and released appearance is the same, 
  29. --*                    just set the releasedBitmap IV and exitBitmap IV to the same 
  30. --*                    bitmap.
  31. --*
  32. --*            Author:    Su Quek - Kaleida Labs, Inc.
  33. --*******************************************************************************
  34. class RolloverButton (TwoDShape, Button, Rollover)
  35. end
  36.  
  37. -- The following methods are specialized to produce custom appearances.
  38. -- In this example, when the button is pressed, a red stroke appears around 
  39. -- the bitmap.
  40.  
  41. method setPressedAppearance self {class RolloverButton} -> 
  42. (
  43.     nextmethod self
  44.     self.stroke := (new Brush color:redColor)
  45. )
  46.  
  47. method setReleasedAppearance self {class RolloverButton} ->
  48. (
  49.     nextmethod self
  50.     self.stroke := undefined
  51. )
  52.